<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button type="button" id="search">搜索</button>
    <div id="outer">

    </div>
    
    <script src="../../part03-bootstrap/plugins/jquery/jquery.min.js"></script>
    <script>
        $(function(){
            //获取id=outer的div的jquery对象
            let div = $("#outer");

            //jquery对象 => 才能调用jquery的api
           $("#search").click(function(){
              $.get('movie.json',function(res){
                let str="<table>";
                //解析res
                let arr = res.subjects;
                for(let i=0;i<arr.length;i++){
                   
                    str+=`
                        <tr>
                            <td>${arr[i].episodes_info}</td>    
                        </tr>
                    `
                }
                str+="</table>";
        
                div.html(str)
              });
              
           });
           
        })
    </script>
</body>
</html>